package cn.kgc.mes.type.service.impl;

import java.util.List;
import cn.kgc.mes.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.kgc.mes.type.mapper.UnitMeasureMapper;
import cn.kgc.mes.type.domain.UnitMeasure;
import cn.kgc.mes.type.service.IUnitMeasureService;

/**
 * 单位Service业务层处理
 * 
 * @author ydw
 * @date 2025-09-10
 */
@Service
public class UnitMeasureServiceImpl implements IUnitMeasureService 
{
    @Autowired
    private UnitMeasureMapper unitMeasureMapper;

    /**
     * 查询单位
     * 
     * @param measureId 单位主键
     * @return 单位
     */
    @Override
    public UnitMeasure selectUnitMeasureByMeasureId(Long measureId)
    {
        return unitMeasureMapper.selectUnitMeasureByMeasureId(measureId);
    }

    /**
     * 查询单位列表
     * 
     * @param unitMeasure 单位
     * @return 单位
     */
    @Override
    public List<UnitMeasure> selectUnitMeasureList(UnitMeasure unitMeasure)
    {
        return unitMeasureMapper.selectUnitMeasureList(unitMeasure);
    }

    /**
     * 新增单位
     * 
     * @param unitMeasure 单位
     * @return 结果
     */
    @Override
    public int insertUnitMeasure(UnitMeasure unitMeasure)
    {
        unitMeasure.setCreateTime(DateUtils.getNowDate());
        return unitMeasureMapper.insertUnitMeasure(unitMeasure);
    }

    /**
     * 修改单位
     * 
     * @param unitMeasure 单位
     * @return 结果
     */
    @Override
    public int updateUnitMeasure(UnitMeasure unitMeasure)
    {
        unitMeasure.setUpdateTime(DateUtils.getNowDate());
        return unitMeasureMapper.updateUnitMeasure(unitMeasure);
    }

    /**
     * 批量删除单位
     * 
     * @param measureIds 需要删除的单位主键
     * @return 结果
     */
    @Override
    public int deleteUnitMeasureByMeasureIds(Long[] measureIds)
    {
        return unitMeasureMapper.deleteUnitMeasureByMeasureIds(measureIds);
    }

    /**
     * 删除单位信息
     * 
     * @param measureId 单位主键
     * @return 结果
     */
    @Override
    public int deleteUnitMeasureByMeasureId(Long measureId)
    {
        return unitMeasureMapper.deleteUnitMeasureByMeasureId(measureId);
    }
}
